/**
 * Copyright 2011 Jonathan Haas
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package parts.main;

import drawing.View;
import parts.model.AbstractPart;
import simulation.InputPin;

import java.awt.*;
import java.awt.geom.Ellipse2D;

public class Led extends AbstractPart {
    private static Ellipse2D.Double _circle = new Ellipse2D.Double(0, 0, 2, 2);

   private final InputPin _inputPin = new InputPin(1, 1);

        private View _ledView = new View(){
            public void draw(final Graphics2D g2d, final int zoomFactor) {
                final Paint paint = g2d.getPaint();
                if(_inputPin.isPowered()){
                    g2d.setPaint(Color.green);
                }
                else{
                    g2d.setPaint(Color.green.darker());
                }
                g2d.fill(_circle);
                g2d.setPaint(paint);
                g2d.draw(_circle);
            }
        };

    public View getView() {
        return _ledView;
    }

    public Led(final int y, final int x) {
        super(y, x);
    }
}
